package com.faithbj.danaliverpool.common;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;

import com.faithbj.common.utils.JsonUtil;
import com.google.common.collect.ArrayListMultimap;

public class Multimap {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		ArrayListMultimap<String, String> myMultimap = ArrayListMultimap.create();  
		
		List<String> ll=new ArrayList<String>();
	    ll.add("a");
	    ll.add("b");
	    ll.add("c");
	    ll.add("d");
	    
	    List<String> dd=new ArrayList<String>();
	    dd.add("1");
	    dd.add("2");
	    dd.add("3");
	    dd.add("4");
	    
	    myMultimap.putAll("kkk", ll);
		
//		  // Adding some key/value  
//		  myMultimap.put("工商银行", "11111");  
//		  myMultimap.put("工商银行","2222");  
//		  myMultimap.put("工商银行", "3333");  
//		  myMultimap.put("农业银行","3444");  
//		  myMultimap.replaceValues(key, values)
		  System.out.println( myMultimap.toString());
		  System.out.println( myMultimap.asMap());
		  
		  String k=JsonUtil.toJson(myMultimap.asMap());
		  System.out.println( k);
		  
		  Map<String,List<String>> ff=JsonUtil.fromJson(k, Map.class);
		  ff.put("kkk", dd);
		  String fine=JsonUtil.toJson(ff);
		  System.out.println( fine);
 
		  // Getting the size  
/*		  int size = myMultimap.size();  
		  System.out.println(size);  // 4  
		    
		  // Getting values  
		  Collection<String> fruits = myMultimap.get("Fruits");  
		  System.out.println(fruits); // [Bannana, Apple, Pear]  
		    
		  Collection<String> vegetables = myMultimap.get("Vegetables");  
		  System.out.println(vegetables); // [Carrot]  
		    
		  // Iterating over entire Mutlimap  
		  for(String value : myMultimap.values()) {  
		   System.out.println(value);  
		  }  
		    
		  // Removing a single value  
		  myMultimap.remove("Fruits","Pear");  
		  System.out.println(myMultimap.get("Fruits")); // [Bannana, Pear]  
		    
		  // Remove all values for a key  
		  myMultimap.removeAll("Fruits");  
		  System.out.println(myMultimap.get("Fruits")); // [] (Empty Collection!)  
		  
		  String k=JsonUtil.toJson(myMultimap);*/
		  
		 
//		  System.out.println( myMultimap.toString());

	}

}
